Ext.define('Admin.view.training.MyEmploymentGrid', {
	extend: 'Ext.grid.Panel',
    xtype: 'myEmploymentGrid',
    //requires: ['Ext.XTemplate'],

    title: '我的合同',
    layout: 'fit',
    //width: 750,
    //height: 600,

    collapsible: true,
    animCollapse: false,
    columnLines: true,
    //enableLocking: true,
   	bind: '{employmentDataList}',
    //store: 'Companies',

    columns: [
    {
        text: "员工ID",
        flex: 1,
        dataIndex: 'empId'
    },{
        text: "签订时间",
        width: 240,
        formatter: 'date("Y/m/d")',
        dataIndex: 'underWriteDate'
    }, {
        text: "到期时间",
        width: 240,
        formatter: 'date("Y/m/d")',
        dataIndex: 'overDate'
    }
    //{
            //xtype: 'actioncolumn',
            //items: [{
        	//	xtype: 'button',
                //iconCls: 'x-fa fa-pencil',
                //handler : 'openEditWindow'
            //}],
            //cls: 'content-column',
            //width: 100,
            //dataIndex: 'bool',
            //text: '审核',
            //tooltip: '审核'
          //}
     ],

    plugins: [{
        ptype: 'rowexpander',
        rowBodyTpl : new Ext.XTemplate(
            '<p><b>合同期限:</b> {timeLimit}</p>',
            '<p><b>终止时间:</b> {breakDate}</p>',
            '<p><b>终止原因:</b> {breakReason}</p>',
            '<p><b>备注:</b> {remark}</p>',
        {
            formatChange: function(v){
                var color = v >= 0 ? 'green' : 'red';
                return '<span style="color: ' + color + ';">' + Ext.util.Format.usMoney(v) + '</span>';
            }
        })
    }],
    columnLines: true,
	bbar: {
	    xtype: 'pagingtoolbar',//注意以后MVVM中使用新写法,不要使用Ext.create()
        //store: Ext.data.StoreManager.lookup('simpsonsStore'),
        bind: '{employmentDataList}',
        displayInfo: true,
        displayMsg: 'Displaying topics {0} - {1} of {2}',
        emptyMsg: "No topics to display",
        /*items:[
            '-', {
            text: '批量删除',
            listeners: {
			    click:'deleteTrainings'
			}
        }]*/
    }
});